package thingapi

import (
	"iot-base/common/idsync"
	"iot-base/common/webapi"

	"github.com/gin-gonic/gin"
)

func removeThing(c *gin.Context) bool {
	id := c.Param("id")
	if id != "" {
		err := idsync.DirtyThing(id)
		if err != nil {
			webapi.SendError(err.Error(), webapi.DBError, c)
			return true
		}
	}
	return false
}

func removeTModel(c *gin.Context) bool {
	id := c.Param("id")
	if id != "" {
		err := idsync.DirtyTModel(id)
		if err != nil {
			webapi.SendError(err.Error(), webapi.DBError, c)
			return true
		}
	}
	return false
}
